package com.breakfast.fun.data.entity.user;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by hp on 2016/8/24.
 */
public class Result {

    /**
     * version : 1.0
     * success : false
     * errCode : 6000
     * msg : Required Long parameter 'userId' is not present
     */

    private String version;
    private boolean success;
    private int errCode;
    private String msg;
    private Object data;
    private int total;
    private int pageTotal;


    public static Result objectFromData(String str) {

        return new Gson().fromJson(str, Result.class);
    }

    public static List<Result> arrayResultFromData(String str) {

        Type listType = new TypeToken<ArrayList<Result>>() {
        }.getType();

        return new Gson().fromJson(str, listType);
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public int getErrCode() {
        return errCode;
    }

    public void setErrCode(int errCode) {
        this.errCode = errCode;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public int getPageTotal() {
        return pageTotal;
    }

    public void setPageTotal(int pageTotal) {
        this.pageTotal = pageTotal;
    }
}
